package com.itzxx.huazhun.data.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update


/**
 * Desc:
 *
 * Author: zhangxiaoxiao
 * Date: 2024/8/6 19:00
 * Updater:
 * Update Time:
 * Update Comments:
 */

@Dao
interface CollectionDao {
    //添加  传递一个参数 对象
    @Insert
    fun insert(item: CollectionEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertAll(items: List<CollectionEntity>)

    @Query("SELECT * FROM collection_record WHERE probe_mac = :mac AND recordStartTime = :startTime")
    fun getCollectionRecord(mac: String,startTime:String): CollectionEntity?

    @Update
    fun update(item: CollectionEntity)

    @Query("SELECT * FROM collection_record WHERE state != 1")
    fun getCollectionRecordList():  List<CollectionEntity>

    @Query("SELECT * FROM collection_record WHERE id IN (:ids)")
    fun getCollectionRecordList(ids: List<Int>):  List<CollectionEntity>
}